<!--#Include File="../Inc/Config.asp"-->
<!--#Include File="../Inc/Md5.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Dim UId,ULogin,UPwd,UName,UType,UTypeName,ULimit,UShowMenu,UShowModule
Dim u_rUrl

'UE上传附件cookie读回
If Request.QueryString("immediate")="5" And Request.QueryString("u")<>"" And Request.QueryString("p")<>"" Then
	Response.Cookies("u_f02")=Request.QueryString("u")
	Response.Cookies("p_f02")=Request.QueryString("p")
End If

'管理员登录校验
LoginScript="<script type=""text/javascript"">$(document).ready(function(){sysDebug="&Fk_Site_Debug&";dialogOpen('Login.asp?Type=1','300');});</script>"
If Request.Cookies("u_f02")<>"" And Request.Cookies("p_f02")<>"" Then
	ULogin=FKFun.HTMLEncode(Request.Cookies("u_f02"))
	UPwd=FKFun.HTMLEncode(Request.Cookies("p_f02"))
	Sqlstr="Select Fk_Admin_Id,Fk_Admin_LoginPass,Fk_Admin_Name,Fk_Admin_Type,Fk_Admin_Limit From [Fk_Admin] Where Fk_Admin_State=1 And Fk_Admin_LoginName='"&ULogin&"'"
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		If UPwd=Md5(Rs("Fk_Admin_LoginPass")&"f02"&Request.ServerVariables("REMOTE_ADDR")&Date(),16) Then
			UId=Rs("Fk_Admin_Id")
			UName=Rs("Fk_Admin_Name")
			UType=Rs("Fk_Admin_Type")
			ULimit=Rs("Fk_Admin_Limit")
			UTypeName=FKFun.GetAdminTypeName(UType)
			If UType=0 Then
				ULimit="all"
				UShowMenu="all"
				UShowModule="all"
				u_rUrl="Get.asp?Type=3"
			Else
				TempArr=Split(Rs("Fk_Admin_Limit"),"|-|")
				ULimit=TempArr(2)
				UShowMenu=TempArr(0)
				UShowModule=TempArr(1)
				u_rUrl=""
				'普通管理员判断左侧菜单显示
				If Instr(ULimit,"s_")>0 Then
					u_rUrl="Get.asp?Type=3"
				ElseIf Instr(ULimit,"m_")>0 Or Instr(ULimit,"o_")>0 Then
					u_rUrl="Get.asp?Type=6"
				Else
					Rs.Close
					If UShowMenu="all" Then
						Sqlstr="Select Top 1 Fk_Menu_Id From [Fk_Menu] Order By Fk_Menu_Id Asc"
					Else
						Sqlstr="Select Top 1 Fk_Menu_Id From [Fk_Menu] Where Fk_Menu_Id In (0"&UShowMenu&"0) Order By Fk_Menu_Id Asc"
					End If
					Rs.Open Sqlstr,Conn,1,1
					If Not Rs.Eof Then
						u_rUrl="Get.asp?Type=7&Menu="&Rs("Fk_Menu_Id")
					End If
				End If
			End If
			IsLogin=True
			LoginScript="<script type=""text/javascript"">$(document).ready(function(){sysDebug="&Fk_Site_Debug&";rUrl='"&u_rUrl&"';adminLoading();ext_link='"&Fk_Site_LinkExt&"';ext_img='"&Fk_Site_PicExt&"';ext_flash='"&Fk_Site_FlashExt&"';ext_media='"&Fk_Site_MediaExt&"';});</script>"
		Else
			IsLogin=False
		End If
	Else
		IsLogin=False
	End If
	Rs.Close
Else
	IsLogin=False
End If

'校验管理员权限
Function CheckAdminType(a_Check,a_Type)
	If IsLogin=False Then
		Response.Write("您没有登录或者已经退出，请返回首页重新登录！")
		Call FKFun.AlertInfo("您没有登录或者已经退出，请返回首页重新登录！","Index.asp")
	ElseIf Instr(","&a_Check&",",","&a_Type&",")=0 Then
		Response.Write("权限不足！")
		Call FKFun.AlertInfo("权限不足！","Index.asp")
	End If
End Function

'检验普通管理员权限
Function CheckAdminLimit(a_Limit,a_PageId,rType)
	If Instr(a_Limit,","&a_PageId&",")=0 And a_Limit<>"all" Then
		If rType=0 Then
			Response.Write("权限不足！")
			Call FKFun.AlertInfo("权限不足！","Index.asp")
		Else
			CheckAdminLimit=False
		End If
	Else
		CheckAdminLimit=True
	End If
End Function
%>